package cn.wolfcode.luowowo.ticket.service.impl;

import cn.wolfcode.luowowo.article.domain.Tourist;
import cn.wolfcode.luowowo.article.domain.TouristInfo;
import cn.wolfcode.luowowo.ticket.mapper.TouristInfoMapper;
import cn.wolfcode.luowowo.ticket.mapper.TouristMapper;
import cn.wolfcode.luowowo.ticket.service.ITouristService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class TouristServiceImpl implements ITouristService {
    @Autowired
    private TouristMapper touristMapper;
    @Autowired
    private TouristInfoMapper touristInfoMapper;

    @Override
    public List<Tourist> selectByDestIdAndSubId(Long destId, Long subId) {
        return touristMapper.selectByDestIdAndSubId (destId, subId);
    }

    @Override
    public Tourist getById(Long id) {
        Tourist tourist = touristMapper.selectByPrimaryKey (id);
        TouristInfo info = touristInfoMapper.selectByPrimaryKey (id);
        tourist.setInfo (info);
        return tourist;
    }

    @Override
    public List<Tourist> getCommendByTicketId(Long ticketId) {
        return touristMapper.selectBytid (ticketId);
    }
}
